{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e0295b7c-18c6-4f6b-b662-dd54b3ead103",
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://mirrors.aliyun.com/pypi/simple/\n",
      "Collecting sympy\n",
      "  Downloading https://mirrors.aliyun.com/pypi/packages/2d/49/a2d03101e2d28ad528968144831d506344418ef1cc04839acdbe185889c2/sympy-1.11.1-py3-none-any.whl (6.5 MB)\n",
      "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.5/6.5 MB\u001b[0m \u001b[31m8.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0mm\n",
      "\u001b[?25hCollecting mpmath>=0.19\n",
      "  Downloading https://mirrors.aliyun.com/pypi/packages/d4/cf/3965bddbb4f1a61c49aacae0e78fd1fe36b5dc36c797b31f30cf07dcbbb7/mpmath-1.2.1-py3-none-any.whl (532 kB)\n",
      "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m532.6/532.6 kB\u001b[0m \u001b[31m4.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: mpmath, sympy\n",
      "Successfully installed mpmath-1.2.1 sympy-1.11.1\n"
     ]
    }
   ],
   "source": [
    "# 先安装第三方模块，在导入\n",
    "\n",
    "# 包安装，镜像网站加速\n",
    "!pip3.11 install -l https://pypi.tuna.tsinghua.edu.cn/simple package_name   # 临时加速\n",
    "!cat ~/AppData/Roaming/pip/pip.ini  # 永久加速\n",
    "    # [global]\n",
    "    # index-url=http://mirrors.aliyun.com/pypi/simple/\n",
    "    # [install]\n",
    "    # trusted-host=mirrors.aliyun.com\n",
    "# pip config list\n",
    "# !python -m pip install sympy\n",
    "!pip3.11 install sympy"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ae948131",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "'source' �����ڲ����ⲿ���Ҳ���ǿ����еĳ���\n",
      "���������ļ���\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: http://mirrors.aliyun.com/pypi/simple/\n",
      "Requirement already satisfied: anyio==3.7.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 1)) (3.7.1)\n",
      "Requirement already satisfied: argon2-cffi==21.3.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 2)) (21.3.0)\n",
      "Requirement already satisfied: argon2-cffi-bindings==21.2.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 3)) (21.2.0)\n",
      "Requirement already satisfied: arrow==1.2.3 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 4)) (1.2.3)\n",
      "Requirement already satisfied: asttokens==2.2.1 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 5)) (2.2.1)\n",
      "Requirement already satisfied: attrs==23.1.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 6)) (23.1.0)\n",
      "Requirement already satisfied: backcall==0.2.0 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 7)) (0.2.0)\n",
      "Requirement already satisfied: beautifulsoup4==4.12.2 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 8)) (4.12.2)\n",
      "Requirement already satisfied: bleach==6.0.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 9)) (6.0.0)\n",
      "Requirement already satisfied: cffi==1.15.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 10)) (1.15.1)\n",
      "Requirement already satisfied: colorama==0.4.6 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 11)) (0.4.6)\n",
      "Requirement already satisfied: comm==0.1.3 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 12)) (0.1.3)\n",
      "Requirement already satisfied: debugpy==1.6.7 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 13)) (1.6.7)\n",
      "Requirement already satisfied: decorator==5.1.1 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 14)) (5.1.1)\n",
      "Requirement already satisfied: defusedxml==0.7.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 15)) (0.7.1)\n",
      "Requirement already satisfied: executing==1.2.0 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 16)) (1.2.0)\n",
      "Requirement already satisfied: fastjsonschema==2.17.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 17)) (2.17.1)\n",
      "Requirement already satisfied: fqdn==1.5.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 18)) (1.5.1)\n",
      "Requirement already satisfied: idna==3.4 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 19)) (3.4)\n",
      "Requirement already satisfied: ipykernel==6.24.0 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 20)) (6.24.0)\n",
      "Requirement already satisfied: ipython==8.14.0 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 21)) (8.14.0)\n",
      "Requirement already satisfied: ipython-genutils==0.2.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 22)) (0.2.0)\n",
      "Requirement already satisfied: ipywidgets==8.0.7 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 23)) (8.0.7)\n",
      "Requirement already satisfied: isoduration==20.11.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 24)) (20.11.0)\n",
      "Requirement already satisfied: jedi==0.18.2 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 25)) (0.18.2)\n",
      "Requirement already satisfied: Jinja2==3.1.2 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 26)) (3.1.2)\n",
      "Requirement already satisfied: jsonpointer==2.4 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 27)) (2.4)\n",
      "Requirement already satisfied: jsonschema==4.18.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 28)) (4.18.0)\n",
      "Requirement already satisfied: jsonschema-specifications==2023.6.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 29)) (2023.6.1)\n",
      "Requirement already satisfied: jupyter==1.0.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 30)) (1.0.0)\n",
      "Requirement already satisfied: jupyter-console==6.6.3 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 31)) (6.6.3)\n",
      "Requirement already satisfied: jupyter-events==0.6.3 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 32)) (0.6.3)\n",
      "Requirement already satisfied: jupyter_client==8.3.0 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 33)) (8.3.0)\n",
      "Requirement already satisfied: jupyter_core==5.3.1 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 34)) (5.3.1)\n",
      "Requirement already satisfied: jupyter_server==2.7.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 35)) (2.7.0)\n",
      "Requirement already satisfied: jupyter_server_terminals==0.4.4 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 36)) (0.4.4)\n",
      "Requirement already satisfied: jupyterlab-pygments==0.2.2 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 37)) (0.2.2)\n",
      "Requirement already satisfied: jupyterlab-widgets==3.0.8 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 38)) (3.0.8)\n",
      "Requirement already satisfied: MarkupSafe==2.1.3 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 39)) (2.1.3)\n",
      "Requirement already satisfied: matplotlib-inline==0.1.6 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 40)) (0.1.6)\n",
      "Requirement already satisfied: mistune==3.0.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 41)) (3.0.1)\n",
      "Requirement already satisfied: nbclassic==1.0.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 42)) (1.0.0)\n",
      "Requirement already satisfied: nbclient==0.8.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 43)) (0.8.0)\n",
      "Requirement already satisfied: nbconvert==7.6.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 44)) (7.6.0)\n",
      "Requirement already satisfied: nbformat==5.9.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 45)) (5.9.0)\n",
      "Requirement already satisfied: nest-asyncio==1.5.6 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 46)) (1.5.6)\n",
      "Requirement already satisfied: notebook==6.5.4 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 47)) (6.5.4)\n",
      "Requirement already satisfied: notebook_shim==0.2.3 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 48)) (0.2.3)\n",
      "Requirement already satisfied: numpy==1.25.2 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 49)) (1.25.2)\n",
      "Requirement already satisfied: overrides==7.3.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 50)) (7.3.1)\n",
      "Requirement already satisfied: packaging==23.1 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 51)) (23.1)\n",
      "Requirement already satisfied: pandocfilters==1.5.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 52)) (1.5.0)\n",
      "Requirement already satisfied: parso==0.8.3 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 53)) (0.8.3)\n",
      "Requirement already satisfied: pickleshare==0.7.5 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 54)) (0.7.5)\n",
      "Requirement already satisfied: platformdirs==3.8.1 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 55)) (3.8.1)\n",
      "Requirement already satisfied: prometheus-client==0.17.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 56)) (0.17.0)\n",
      "Requirement already satisfied: prompt-toolkit==3.0.39 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 57)) (3.0.39)\n",
      "Requirement already satisfied: psutil==5.9.5 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 58)) (5.9.5)\n",
      "Requirement already satisfied: pure-eval==0.2.2 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 59)) (0.2.2)\n",
      "Requirement already satisfied: pycparser==2.21 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 60)) (2.21)\n",
      "Requirement already satisfied: Pygments==2.15.1 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 61)) (2.15.1)\n",
      "Requirement already satisfied: pynput==1.7.6 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 62)) (1.7.6)\n",
      "Requirement already satisfied: python-dateutil==2.8.2 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 63)) (2.8.2)\n",
      "Requirement already satisfied: python-json-logger==2.0.7 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 64)) (2.0.7)\n",
      "Requirement already satisfied: pywin32==306 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 65)) (306)\n",
      "Requirement already satisfied: pywinpty==2.0.10 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 66)) (2.0.10)\n",
      "Requirement already satisfied: PyYAML==6.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 67)) (6.0)\n",
      "Requirement already satisfied: pyzmq==25.1.0 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 68)) (25.1.0)\n",
      "Requirement already satisfied: qtconsole==5.4.3 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 69)) (5.4.3)\n",
      "Requirement already satisfied: QtPy==2.3.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 70)) (2.3.1)\n",
      "Requirement already satisfied: referencing==0.29.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 71)) (0.29.1)\n",
      "Requirement already satisfied: rfc3339-validator==0.1.4 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 72)) (0.1.4)\n",
      "Requirement already satisfied: rfc3986-validator==0.1.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 73)) (0.1.1)\n",
      "Requirement already satisfied: rpds-py==0.8.10 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 74)) (0.8.10)\n",
      "Requirement already satisfied: Send2Trash==1.8.2 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 75)) (1.8.2)\n",
      "Requirement already satisfied: six==1.16.0 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 76)) (1.16.0)\n",
      "Requirement already satisfied: sniffio==1.3.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 77)) (1.3.0)\n",
      "Requirement already satisfied: soupsieve==2.4.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 78)) (2.4.1)\n",
      "Requirement already satisfied: stack-data==0.6.2 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 79)) (0.6.2)\n",
      "Requirement already satisfied: terminado==0.17.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 80)) (0.17.1)\n",
      "Requirement already satisfied: tinycss2==1.2.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 81)) (1.2.1)\n",
      "Requirement already satisfied: tinydb==4.8.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 82)) (4.8.0)\n",
      "Requirement already satisfied: tornado==6.3.2 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 83)) (6.3.2)\n",
      "Requirement already satisfied: traitlets==5.9.0 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 84)) (5.9.0)\n",
      "Requirement already satisfied: uri-template==1.3.0 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 85)) (1.3.0)\n",
      "Requirement already satisfied: wcwidth==0.2.6 in c:\\users\\jn-sh\\appdata\\roaming\\python\\python311\\site-packages (from -r requirements.txt (line 86)) (0.2.6)\n",
      "Requirement already satisfied: webcolors==1.13 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 87)) (1.13)\n",
      "Requirement already satisfied: webencodings==0.5.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 88)) (0.5.1)\n",
      "Requirement already satisfied: websocket-client==1.6.1 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 89)) (1.6.1)\n",
      "Requirement already satisfied: widgetsnbextension==4.0.8 in c:\\users\\jn-sh\\appdata\\local\\programs\\python\\python311\\lib\\site-packages (from -r requirements.txt (line 90)) (4.0.8)\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "[notice] A new release of pip is available: 23.1.2 -> 23.2.1\n",
      "[notice] To update, run: python.exe -m pip install --upgrade pip\n",
      "'deactivate' �����ڲ����ⲿ���Ҳ���ǿ����еĳ���\n",
      "���������ļ���\n"
     ]
    }
   ],
   "source": [
    "# 创建虚拟环境，软件包版本隔离\n",
    "!python -m venv myvenv\n",
    "!ls myvenv/lib/site-packages   # 包安装在虚拟环境的位置，就是个文件夹需要是直接引入\n",
    "# 将当前安装的包及其版本保存到文件中\n",
    "!pip freeze > requirements.txt\n",
    "# 激活进入虚拟环境   win系统\n",
    "!source myvenv/bin/activate.bat\n",
    "# 在虚拟环境中导入指定的包\n",
    "%pip install -r requirements.txt\n",
    "# 离开虚拟环境\n",
    "!deactivate"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
